package com.kz.demo;

import com.kz.framework.annotation.aop.MyAfter;
import com.kz.framework.annotation.aop.MyAround;
import com.kz.framework.annotation.aop.MyAspect;
import com.kz.framework.annotation.aop.MyBefore;
import com.kz.framework.proxy.ProceedingJoinPoint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author zhgp
 * @version 1.0
 * @description: TODO
 * @date 2021/7/3 11:44
 */

@MyAspect
public class Aspect {
    private static final Logger LOGGER = LoggerFactory.getLogger(Aspect.class);

    @MyAround(targetMethod = TestAop.class)
    public Object around(ProceedingJoinPoint point) throws Exception {
        LOGGER.info("我开始了.........");
        Object o = point.proceed(point.getArgs());
        LOGGER.info("我结束了");
        return o;
    }

    @MyAround(targetMethod = TestAop.class)
    public Object around1(ProceedingJoinPoint point) throws Exception {
        LOGGER.info("我开始了1.........");
        Object o = point.proceed(point.getArgs());
        LOGGER.info("我结束了1");
        return o;
    }

    @MyBefore(targetMethod = TestAop.class)
    public void before(ProceedingJoinPoint point) {
        LOGGER.info("我是前置.........");
    }

    @MyAfter(targetMethod = TestAop.class)
    public void after(ProceedingJoinPoint point) {
        LOGGER.info("我是后置.........");
    }

}
